package com.java123.web.t2.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;

public class HelloServlet extends HttpServlet{

	private static final long serialVersionUID = -4886362850804822985L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("do get....");
		response.setStatus(HttpServletResponse.SC_OK);
		response.getWriter().write("success");
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("do post....");
	}

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("do service....");
		System.out.println("-----hello-----");
		response.setStatus(HttpServletResponse.SC_OK);
		System.out.println(JSONObject.toJSONString(request.getParameterNames()));;
		response.getWriter().write("hello success");
		
	}

	@Override
	public void destroy() {
		System.out.println("destroy.....");
		super.destroy();
	}

	@Override
	public void init() throws ServletException {
		System.out.println("init.....");
		super.init();
	}
	
	
	
	
	

	
	
}
